import Vue from 'vue'
import Vuex from 'vuex'

import { openApiSysCourseChapterQuery } from '@/api/admin/courseLibrary/sysCourseChapter'

Vue.use(Vuex)

const state = {
  courseChapter: [],
}

const getters = {}

const actions = {
  async queryOpenApiSysCourseChapter({ commit }, listQuery) {
    let res = await openApiSysCourseChapterQuery({ ...listQuery })
    return res.data.code == 0 ? res.data : Promise.reject(new Error('faile'))
  },
}

const mutations = {
  SET_COURSECHAPTER: (state, d) => {
    state.courseChapter = d
  },
}

export default {
  state,
  getters,
  actions,
  mutations,
}
